using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using Decisions.HL7.Message;
using DecisionsFramework;

namespace Decisions.HL7.Message
{
    public class RouteofAdministrationAttribute:RuleAttribute
    {
        private Dictionary<HL7Version, string[]> validVersionCodes = new Dictionary<HL7Version, string[]>();
        private Dictionary<HL7Version, string[]> validVersionDescriptions = new Dictionary<HL7Version, string[]>();
        private Dictionary<HL7Version, HL7TableType> tableVersionTypes = new Dictionary<HL7Version, HL7TableType>();

        public RouteofAdministrationAttribute()
        {
            // init the values for table version types
						tableVersionTypes[HL7Version.v23] = HL7TableType.HL7;
						tableVersionTypes[HL7Version.v231] = HL7TableType.HL7;
						tableVersionTypes[HL7Version.v24] = HL7TableType.HL7;
						tableVersionTypes[HL7Version.v25] = HL7TableType.HL7;
						tableVersionTypes[HL7Version.v251] = HL7TableType.User;
						tableVersionTypes[HL7Version.v26] = HL7TableType.User;
						tableVersionTypes[HL7Version.v27] = HL7TableType.User;
			
            
			// init the values for version codes
						validVersionCodes[HL7Version.v23] = new string[]{"AP","B","DT","EP","ET","GTT","GU","IA","IB","IC","ICV","ID","IH","IMR","MM","NG","NP","NS","NT","OP","OT","OTH","PF","PO","PR","RM","SC","SD","SL","TD","TL","TP","TRA","UR","VG","VM","WND"};
						validVersionCodes[HL7Version.v231] = new string[]{"AP","B","DT","EP","ET","GTT","GU","IMR","IA","IB","IC","ICV","ID","IH","IHA","IM","IN","IO","IP","IS","IT","IU","IV","MTH","MM","NS","NG","NP","NT","OP","OT","OTH","PF","PO","PR","RM","SD","SC","SL","TP","TRA","TD","TL","UR","VG","VM","WND"};
						validVersionCodes[HL7Version.v24] = new string[]{"AP","B","DT","EP","ET","GTT","GU","IMR","IA","IB","IC","ICV","ID","IH","IHA","IM","IN","IO","IP","IS","IT","IU","IV","MTH","MM","NS","NG","NP","NT","OP","OT","OTH","PF","PO","PR","RM","SD","SC","SL","TP","TRA","TD","TL","UR","VG","VM","WND"};
						validVersionCodes[HL7Version.v25] = new string[]{"AP","B","DT","EP","ET","GTT","GU","IMR","IA","IB","IC","ICV","ID","IH","IHA","IM","IN","IO","IP","IS","IT","IU","IV","MTH","MM","NS","NG","NP","NT","OP","OT","OTH","PF","PO","PR","RM","SD","SC","SL","TP","TRA","TD","TL","UR","VG","VM","WND"};
						validVersionCodes[HL7Version.v251] = new string[]{"AP","B","DT","EP","ET","GTT","GU","IMR","IA","IB","IC","ICV","ID","IH","IHA","IM","IN","IO","IP","IS","IT","IU","IV","MTH","MM","NS","NG","NP","NT","OP","OT","OTH","PF","PO","PR","RM","SD","SC","SL","TP","TRA","TD","TL","UR","VG","VM","WND"};
						validVersionCodes[HL7Version.v26] = new string[]{"AP","B","DT","EP","ET","GTT","GU","IMR","IA","IB","IC","ICV","ID","IH","IHA","IM","IN","IO","IP","IS","IT","IU","IV","MTH","MM","NS","NG","NP","NT","OP","OT","OTH","PF","PO","PR","RM","SD","SC","SL","TP","TRA","TD","TL","UR","VG","VM","WND"};
						validVersionCodes[HL7Version.v27] = new string[]{"AP","B","DT","EP","ET","GTT","GU","IMR","IA","IB","IC","ICV","ID","IH","IHA","IM","IN","IO","IP","IS","IT","IU","IV","MTH","MM","NS","NG","NP","NT","OP","OT","OTH","PF","PO","PR","RM","SD","SC","SL","TP","TRA","TD","TL","UR","VG","VM","WND"};
			
			// init the values for version descriptions
						validVersionDescriptions[HL7Version.v23] = new string[]{"Apply Externally","Buccal","Dental","Epidural","Endotrachial Tube (Used primarily for respiratory therapy and anesthesia delivery)","Gastronomy Tube","GU Irrigant","Intra-arterial","Intrabursal","Intracardiac","Intracervical (uterus)","Intradermal","Inhalation","Immerse (Soak) Body Part","Mucous Membrane","Nasogastric","Nasal Prongs (Used primarily for respiratory therapy and anesthesia delivery)","Nasal","Nasotrachial Tube","Ophthalmic","Otic","Other/Miscellaneous","Perfusion","Oral","Rectal","Rebreather Mask (Used primarily for respiratory therapy and anesthesia delivery)","Subcutaneous","Soaked Dressing","Sublingual","Transdermal","Translingual","Topical","Tracheostomy (Used primarily for respiratory therapy and anesthesia delivery)","Urethral","Vaginal","Ventimask","Wound"};
						validVersionDescriptions[HL7Version.v231] = new string[]{"Apply Externally","Buccal","Dental","Epidural","Endotrachial Tube*","Gastrostomy Tube","GU Irrigant","Immerse (Soak) Body Part","Intra-arterial","Intrabursal","Intracardiac","Intracervical (uterus)","Intradermal","Inhalation","Intrahepatic Artery","Intramuscular","Intranasal","Intraocular","Intraperitoneal","Intrasynovial","Intrathecal","Intrauterine","Intravenous","Mouth/Throat","Mucous Membrane","Nasal","Nasogastric","Nasal Prongs*","Nasotrachial Tube","Ophthalmic","Otic","Other/Miscellaneous","Perfusion","Oral","Rectal","Rebreather Mask*","Soaked Dressing","Subcutaneous","Sublingual","Topical","Tracheostomy*","Transdermal","Translingual","Urethral","Vaginal","Ventimask","Wound"};
						validVersionDescriptions[HL7Version.v24] = new string[]{"Apply Externally","Buccal","Dental","Epidural","Endotrachial Tube*","Gastrostomy Tube","GU Irrigant","Immerse (Soak) Body Part","Intra-arterial","Intrabursal","Intracardiac","Intracervical (uterus)","Intradermal","Inhalation","Intrahepatic Artery","Intramuscular","Intranasal","Intraocular","Intraperitoneal","Intrasynovial","Intrathecal","Intrauterine","Intravenous","Mouth/Throat","Mucous Membrane","Nasal","Nasogastric","Nasal Prongs*","Nasotrachial Tube","Ophthalmic","Otic","Other/Miscellaneous","Perfusion","Oral","Rectal","Rebreather Mask*","Soaked Dressing","Subcutaneous","Sublingual","Topical","Tracheostomy*","Transdermal","Translingual","Urethral","Vaginal","Ventimask","Wound"};
						validVersionDescriptions[HL7Version.v25] = new string[]{"Apply Externally","Buccal","Dental","Epidural","Endotrachial Tube*","Gastrostomy Tube","GU Irrigant","Immerse (Soak) Body Part","Intra-arterial","Intrabursal","Intracardiac","Intracervical (uterus)","Intradermal","Inhalation","Intrahepatic Artery","Intramuscular","Intranasal","Intraocular","Intraperitoneal","Intrasynovial","Intrathecal","Intrauterine","Intravenous","Mouth/Throat","Mucous Membrane","Nasal","Nasogastric","Nasal Prongs*","Nasotrachial Tube","Ophthalmic","Otic","Other/Miscellaneous","Perfusion","Oral","Rectal","Rebreather Mask*","Soaked Dressing","Subcutaneous","Sublingual","Topical","Tracheostomy*","Transdermal","Translingual","Urethral","Vaginal","Ventimask","Wound"};
						validVersionDescriptions[HL7Version.v251] = new string[]{"Apply Externally","Buccal","Dental","Epidural","Endotrachial Tube*","Gastrostomy Tube","GU Irrigant","Immerse (Soak) Body Part","Intra-arterial","Intrabursal","Intracardiac","Intracervical (uterus)","Intradermal","Inhalation","Intrahepatic Artery","Intramuscular","Intranasal","Intraocular","Intraperitoneal","Intrasynovial","Intrathecal","Intrauterine","Intravenous","Mouth/Throat","Mucous Membrane","Nasal","Nasogastric","Nasal Prongs*","Nasotrachial Tube","Ophthalmic","Otic","Other/Miscellaneous","Perfusion","Oral","Rectal","Rebreather Mask*","Soaked Dressing","Subcutaneous","Sublingual","Topical","Tracheostomy*","Transdermal","Translingual","Urethral","Vaginal","Ventimask","Wound"};
						validVersionDescriptions[HL7Version.v26] = new string[]{"Apply Externally","Buccal","Dental","Epidural","Endotrachial Tube*","Gastrostomy Tube","GU Irrigant","Immerse (Soak) Body Part","Intra-arterial","Intrabursal","Intracardiac","Intracervical (uterus)","Intradermal","Inhalation","Intrahepatic Artery","Intramuscular","Intranasal","Intraocular","Intraperitoneal","Intrasynovial","Intrathecal","Intrauterine","Intravenous","Mouth/Throat","Mucous Membrane","Nasal","Nasogastric","Nasal Prongs*","Nasotrachial Tube","Ophthalmic","Otic","Other/Miscellaneous","Perfusion","Oral","Rectal","Rebreather Mask*","Soaked Dressing","Subcutaneous","Sublingual","Topical","Tracheostomy*","Transdermal","Translingual","Urethral","Vaginal","Ventimask","Wound"};
						validVersionDescriptions[HL7Version.v27] = new string[]{"Apply Externally","Buccal","Dental","Epidural","Endotrachial Tube*","Gastrostomy Tube","GU Irrigant","Immerse (Soak) Body Part","Intra-arterial","Intrabursal","Intracardiac","Intracervical (uterus)","Intradermal","Inhalation","Intrahepatic Artery","Intramuscular","Intranasal","Intraocular","Intraperitoneal","Intrasynovial","Intrathecal","Intrauterine","Intravenous","Mouth/Throat","Mucous Membrane","Nasal","Nasogastric","Nasal Prongs*","Nasotrachial Tube","Ophthalmic","Otic","Other/Miscellaneous","Perfusion","Oral","Rectal","Rebreather Mask*","Soaked Dressing","Subcutaneous","Sublingual","Topical","Tracheostomy*","Transdermal","Translingual","Urethral","Vaginal","Ventimask","Wound"};
			            

        }

        
        public override ValidationIssue[] RunRule(string name, object owningObject, object value)
        {
            //todo: check if the value is valid in the current version
            //if the value is not valid in the current version, add it as a validation issue


            return new ValidationIssue[0];
        }
    }
}
